package com.deep.spring.v19;


import org.springframework.context.annotation.DeferredImportSelector;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.stereotype.Component;

import java.util.function.Predicate;

@Component
public class MyDeferredImportSelector implements DeferredImportSelector {

    // getImportGroup 和 selectImports 只有一个生效，getImportGroup 优先级高
    @Override
    public String[] selectImports(AnnotationMetadata importingClassMetadata) {
        System.out.println("MyDeferredImportSelector selectImports");
//        return new String[]{"com.deep.spring.v19.bean.Human"};
        return new String[]{"com.deep.spring.v19.bean.Human", "com.deep.spring.v19.bean.Person"};
    }

//    @Override
//    public Predicate<String> getExclusionFilter() {
//        return null;
//    }

    @Override
    public Class<? extends Group> getImportGroup() {
        System.out.println("MyDeferredImportSelector getImportGroup");

        return MyGroup.class;
    }
}